Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[media-library] Add missing image loader for MediaLibrary in bare workflow #8304

Merged
merged 4 commits into from May 15, 2020

Conversation

tsapeta
Copy link
Member

@tsapeta tsapeta commented May 14, 2020

Why

Fixes #7826

How

  • Added EXMediaLibraryImageLoader module that implements RCTImageURLLoader so it will be used to load images with assets-library:// and ph:// schemes.

Test Plan

Tested MediaLibrary examples in both bare and manage workflows. Photos are rendering correctly now.

@github-actions
Copy link
Contributor

Native Component List for this branch is ready

@ExpoBot
Copy link

ExpoBot commented May 14, 2020

Messages
📖

Changelog

Generated by 🚫 dangerJS against 70782d1

@lukmccall
Copy link
Contributor

Fails
🚫

📋 Missing Changelog

🛠 Add missing entires to:

🛠 Suggested fixes:

📋 Missing changelog

Apply suggested changes:

diff --git a/packages/expo-media-library/CHANGELOG.md b/packages/expo-media-library/CHANGELOG.md
index bc2ee3c3c9..9f363b2998 100644
--- a/packages/expo-media-library/CHANGELOG.md
+++ b/packages/expo-media-library/CHANGELOG.md
@@ -8,5 +8,6 @@
 
 ### 🐛 Bug fixes
 
+- Add missing image loader for MediaLibrary in bare workflow. ([#8304](https://github.com/expo/expo/pull/8304) by [@tsapeta](https://github.com/tsapeta))
 - Fixed `MediaLibrary` not compiling with the `use_frameworks!` option in the bare React Native application. ([#7861](https://github.com/expo/expo/pull/7861) by [@Ashoat](https://github.com/Ashoat))
 - Flip dimensions based on media rotation data on Android to match `<Image>` and `<Video>` as well as iOS behavior. ([#7980](https://github.com/expo/expo/pull/7980) by [@Ashoat](https://github.com/Ashoat))

or merge this pull request: #8306

Generated by 🚫 dangerJS against 499041b

@tsapeta tsapeta marked this pull request as ready for review May 14, 2020 17:18
@tsapeta tsapeta requested a review from lukmccall as a code owner May 14, 2020 17:18
@tsapeta tsapeta requested a review from sjchmiela May 15, 2020 07:44
Copy link
Contributor

@sjchmiela sjchmiela left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for taking care of this! 😍

packages/expo-media-library/CHANGELOG.md Outdated Show resolved Hide resolved
@@ -19,4 +19,5 @@ Pod::Spec.new do |s|
s.dependency 'UMCore'
s.dependency 'UMPermissionsInterface'
s.dependency 'UMFileSystemInterface'
s.dependency 'React'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pity that we need to add this line, but this shouldn't break anything!

@tsapeta tsapeta merged commit 758c4d1 into master May 15, 2020
@tsapeta tsapeta deleted the @tsapeta/fix-missing-medialibrary-loader branch May 15, 2020 09:38

// Note: PhotoKit defaults to a deliveryMode of PHImageRequestOptionsDeliveryModeOpportunistic
// which means it may call back multiple times - we probably don't want that
imageOptions.deliveryMode = PHImageRequestOptionsDeliveryModeHighQualityFormat;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean that if a user attempts to upload a ph:// URI directly using fetch, the image might get upscaled (increase in size)? In stock React Native there’s the ph-upload:// to be used in uploads to avoid the upscaling issue

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think you may be right 🤔 My goal was to make it possible to render images with such urls and generally this is the same as photo library image loader from RN: RCTPhotoLibraryImageLoader.mm.
However, looks like it doesn't handle ph-upload:// urls and for that case we would need to copy RCTAssetsLibraryRequestHandler.mm as well. They both provide similar functionality and they both fix an issue with rendering, so I thought we don't need both of them at once. Also looks like stock React Native doesn't include them by default since this is the old code of CameraRoll from before it's been moved to separate repo.

Is this thing important to you? Would you be able to open similar PR but copying request handler functionality?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It’s not important to me personally, I just figured I’d mention it :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, cool, I'll try to fix this anyway before the release 😉 Thanks for pointing this out! 🙇‍♂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot resolve assets-library:// or ph:// schemes on iOS in bare config
5 participants